{	Problem: http://codeforces.ru/problemset/problem/7/A
 	Verdict: Accepted
}
var i,j,r:longint; a:array[1..8,1..8] of byte; f:boolean; c:char;
begin
for i:=1 to 8 do begin
  for j:=1 to 8 do begin
    read(c);
    if c='W' then a[i][j]:=0 else a[i][j]:=1;
  end;
  readln;
end;
r:=0;
for I:=1 to 8 do
  if a[i][1]=1 then begin
    f:=true;
    j:=0;
    while (j<8) and (f) do begin
      inc(j);
      if a[i][j]=0 then f:=false;
    end;
    if f then begin
      inc(r);
      for j:=1 to 8 do a[i][j]:=3;
    end;
  end;
for i:=1 to 8 do
  if a[1][i]=1 then inc(r) else
  if a[1][i]=3 then begin
    f:=false;
    j:=0;
    while (j<8) and (not f) do begin
      inc(j);
      if a[j][i]=1 then f:=true;
    end;
    if f then begin
      inc(r);
      for j:=1 to 8 do a[j][i]:=3;  
    end;
  end;
write(r);
end.